/*
 * VigenereBreaker.h
 *
 *  Created on: Nov 28, 2011
 *      Author: belu
 */

#ifndef VIGENEREBREAKER_H_
#define VIGENEREBREAKER_H_
#include <string>
#include <fstream>
#include "../Crypto/Vigenere.h"

using namespace std;

class VigenereBreaker {
	
public:
	VigenereBreaker();
	virtual ~VigenereBreaker();

	bool breakByKasiskiAttack(string filePath, string filePathKasiski);

private:
	//Vigenere* vigenere;
	
	string decryptKasiski(string mge);
	vector<unsigned long> compararCaracteres(string mge, int cantCaracteres);
	unsigned long long mcd(unsigned long long a, unsigned long long b);
	bool isPrime(unsigned long num);
	string obtenerCriptograma(string mge, unsigned long intervalo, unsigned long caracterInicial);
	vector<int> calcularFrecuencias(string criptograma, string alfabeto);
	string returnClave(string mge, string alfabeto, unsigned long longClave);
};
#endif 
